{% extends "zato/index.html" %}

{% block html_title %}Pub/sub dict values - sub key servers{% endblock %}

{% block "extra_css" %}
    <link rel="stylesheet" type="text/css" href="/static/css/jquery.alerts.css">
{% endblock %}

{% block "extra_js" %}

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.tablesorter.min.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.cookie.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.alerts.min.js"></script>

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>

    <script nonce="{{ CSP_NONCE }}">
    $.fn.zato.data_table.get_columns = function() {
        return [
            '_server',
            '_sub_key',
            '_creation_time'
            '_meta',
            '_extcli',
        ]
    }
    </script>

{% endblock %}

{% block "content" %}
<h2 class="zato">Pub/sub dict {{ dict_name }} {{ server_name }}:{{ server_pid }} (sub key servers), key:{{ key }}</h2>

{% if not zato_clusters %}
    {% include "zato/no-clusters.html" %}
{% else %}
    <div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

    {% if cluster_id %}

        <div id="markup">
            <table id="data-table">
                <thead>
                    <tr class='ignore'>
                        <th style="width:5%">&nbsp;</th>

                        <th><a href="#">Server</a></th>
                        <th><a href="#">Sub key</a></th>
                        <th><a href="#">Creation time</a></th>
                        <th><a href="#">Meta</a></th>
                        <th><a href="#">WSX</a></th>
                </thead>

                <tbody>
                {% if items %}
                {% for item in items %}
                    <tr class="{% cycle 'odd' 'even' %}" id='tr_{{ item.id }}'>
                        <td class='numbering'>&nbsp;</td>

                        <td>
                            {{ item.server_name }}:{{ item.server_pid }}
                        </td>

                        <td>
                            <a href="{% url "pubsub-endpoint-queues" cluster_id item.endpoint_id item.topic_name|slugify %}?cluster={{ cluster_id }}&amp;query={{ item.sub_key }}">{{ item.sub_key }}</a>
                        </td>

                        <td style="min-width:16%">
                            <a
                                id="a_creation_time_{{ item.id }}"
                                href="javascript:$.fn.zato.toggle_time('creation_time_{{ item.id }}', '{{ item.creation_time }}', '{{ item.creation_time_utc }}')">{{ item.creation_time }}
                            </a>
                        </td>
                        <td>
                            clust-id:{{ item.cluster_id }}, chan:{{ item.channel_name }}, endp-t:{{ item.endpoint_type }}, pci:{{ item.pub_client_id }}
                        </td>

                        <td>
                            {{ item.wsx_info }}
                        </td>

                    </tr>
                {% endfor %}
                {% else %}
                    <tr class='ignore'>
                        <td colspan='5'>No results</td>
                    </tr>
                {% endif %}

                </tbody>
            </table>
        </div>


    {% endif %} {% comment %}cluster_id{% endcomment %}

{% endif %}{% comment %}not zato_clusters{% endcomment %}

{% endblock %}
